PDM - an Interface for a Product Data
Manager
In this example a single interface is used to expose the Catalog-Part-Attribute
class hierarchy, which represents a Product Data Manager (PDM) system.
This example demonstrates how to:
-
Expose objects using the single exposure approach
-
Implement the interface as a CORBA server
-
Develop a command line client for the interface
-
Develop an Applet client for the interface
Source Files
-
pdm.idl
Interface Definition Language (IDL) file for the interface CatalogIF
in the pdm module. (IF stands for interface.) Also defined
are exception "PdmError" and the data structures Attribute and Part.
The interface CatalogIF has get and edit operations, which manage the
Parts in the catalog. Notice that there are no fine-grained editing
functions for component Part's and Attribute's. These functions are
not exposed to the interface layer. Consequently, all get operations are
"deep": they return the entire hierarchy of parts. The same is true
for addPart(...).
-
Server.java
The Server code, which has a main function that creates an instance
of the CatalogImpl class and calls obj_is_ready() and impl_is_ready() to
make it available to the client. The main function also generates
the file pdm.ior, which is used by the Applet client.
The code contains the following interface implementation class:
Implementation for
the interface "CatalogIF". It implements the get and edit methods.
-
Client.java
The command line client code. It binds to the CatalogImpl object
using the server name "PDM Server". It then waits for user commands.
The runTerminal method translates command line inputs into method calls
to the server.
-
PdmApplet.java
An Applet client for the pdm interface. The client connects to
the pdm server by first retrieving the pdm.ior file, which contains the
object reference for the Catalog server object. Users can then invoke
commands through the web browser. Currently only Netscape browser
(v.4.5 or higher) works with this example.
Note that the pdm server must be started and running at the same machine
as the web server. Also, the jar file "vbjorb.jar" from VisiBroker
must be copied to Netscape's Plugins directory (e.g. C:\netscape\Program\Plugins).
This jar file contains bytecodes related to VisiBroker's ORB.
Batch Files
-
build.bat
A batch file for building the client and server on Windows.
To build just the Java codes, simply type "build". To build also
the IDL codes, use "build idl". (Note: you need to set the Netscape
path in build.bat in order to build the applet file.)
For the latter case, it will first invoke the IDL compiler and then
compile the client source codes for pdm.idl. A subdirectory named
"pdm" will be created, which contains the CORBA stub codes and their corresponding
class files. A jar file pdm.jar is generated afterwards, which is
used by the Applet client.
-
runsrv.bat
A batch file for running the server. The command line format is:
runsrv
The server name is "PDM Server".
client.bat
A batch file for running the client. The command line format is:
client [hostname] [command.txt]
where the optional hostname (or IP address) is where the server is running
and command.txt is an optional input command file.
(Note: "localhost" may not work for certain network setup. Use the actual
hostname or IP address in that case.)
setenv.bat
A batch file for setting some environment variables.
clean.bat
A batch file for cleaning the directories, leaving only source codes.
Running the Codes
This example was developed under VisiBroker (link).
To run the codes with the command line client, make sure that the VisiBroker Smart Agent (osagent) is
running on the server object's network. Then enter the commands:
On Windows:
start runsrv
client (or client [hostname])
On Unix:
vbj Server &
vbj Client (or vbj Client [hostname])
To run the Applet client, open a Netscape browser and point it to:
studies/pdm/pdm.htm
or, if you have set up the web server, point the browser to:
http://localhost/ooda/pdm/pdm.htm